#ifndef JSONRPCNOTIFICATIONHANDLER_H
#define JSONRPCNOTIFICATIONHANDLER_H

#include "jsonrpcmessage.h"

class JsonRpcNotificationHandler : public QObject
{
    Q_OBJECT

    friend class JsonRpcSocket;
public:
    JsonRpcNotificationHandler(const QString& methodName, QObject *instance, const char* slot);

    JsonRpcMessage notification() const;

    void setAutomaticHandle(bool enable);
    bool getAutomaticHandle() const;

Q_SIGNALS:
    void received();

protected:
    void processNotification(const JsonRpcMessage& notification);

private:
    struct Slot{
        QObject *p_object;
        QString v_slotName;
    };


    bool v_automaticHandle;
    JsonRpcMessage v_notification;
    QString v_methodName;

    Slot v_slot;
};

#endif // JSONRPCNOTIFICATIONHANDLER_H
